package com.hongfeng.web.dao.common;

import java.io.Serializable;
import java.util.List;

import com.hongfeng.web.commons.Page;
import com.hongfeng.web.item.QueryItem;

public interface GenericDao<T, PK extends Serializable> {
	
	/** Persist the new entity object into database */
	public void create(T entity);

	/**
	 * Retrieve an object that was previously persisted to the database using
	 * the indicated id as primary key
	 */
	public T read(PK id);

	/**
	 * Copy the state of the given object onto the persistent object with the
	 * same identifier.
	 */
	public void update(T entity);

	/** Remove an object from persistent storage in the database */
	public void delete(T entity);

	public List<T> findAll();

	public List<T> findAll(QueryItem item);

	public Page<T> findPage(Page<T> page);

	public Page<T> findPage(QueryItem item, Page<T> page);
}
